<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
    
  
  <link href="//cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.min.css" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






  

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

<link href="/lh706.github.io/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="JavaScript,总结," />








  <link rel="shortcut icon" type="image/x-icon" href="/lh706.github.io/favicon.ico?v=5.1.1" />






<meta name="description" content="ES5use strict严格模式 12345678  &amp;quot;use strict&amp;quot;;在严格模式下，会有如下一些限制：未声明的变量赋值直接报错，而不是变成全局变量函数默认的 this 将变成 undefined 而不是默认指向 window对只读属性进行写操作，删除不可删除属性，对不可拓展的对象添加属性均会抛出异常禁止使用 with 语句重名的属性会报错，重名的函数参数会报错">
<meta name="keywords" content="JavaScript,总结">
<meta property="og:type" content="article">
<meta property="og:title" content="ES5,ES6">
<meta property="og:url" content="https://lh706.github.io/lh706.github.io/2017/05/20/ES5-ES6/index.html">
<meta property="og:site_name" content="Albert的blog">
<meta property="og:description" content="ES5use strict严格模式 12345678  &amp;quot;use strict&amp;quot;;在严格模式下，会有如下一些限制：未声明的变量赋值直接报错，而不是变成全局变量函数默认的 this 将变成 undefined 而不是默认指向 window对只读属性进行写操作，删除不可删除属性，对不可拓展的对象添加属性均会抛出异常禁止使用 with 语句重名的属性会报错，重名的函数参数会报错">
<meta property="og:updated_time" content="2017-05-20T06:46:13.787Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ES5,ES6">
<meta name="twitter:description" content="ES5use strict严格模式 12345678  &amp;quot;use strict&amp;quot;;在严格模式下，会有如下一些限制：未声明的变量赋值直接报错，而不是变成全局变量函数默认的 this 将变成 undefined 而不是默认指向 window对只读属性进行写操作，删除不可删除属性，对不可拓展的对象添加属性均会抛出异常禁止使用 with 语句重名的属性会报错，重名的函数参数会报错">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/lh706.github.io/',
    scheme: 'Mist',
    sidebar: {"position":"right","display":"always","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://lh706.github.io/lh706.github.io/2017/05/20/ES5-ES6/"/>





  <title>ES5,ES6 | Albert的blog</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  














  
  
    
  

  <div class="container sidebar-position-right page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/lh706.github.io/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Albert的blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description"></h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/lh706.github.io/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/lh706.github.io/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/lh706.github.io/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-tags " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://lh706.github.io/lh706.github.io/lh706.github.io/2017/05/20/ES5-ES6/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Albert">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/lh706.github.io/my.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Albert的blog">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">ES5,ES6</h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-05-20T14:32:56+08:00">
                2017-05-20
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="ES5"><a href="#ES5" class="headerlink" title="ES5"></a>ES5</h2><h3 id="use-strict"><a href="#use-strict" class="headerlink" title="use strict"></a>use strict</h3><p>严格模式</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">  &quot;use strict&quot;;</div><div class="line"></div><div class="line">在严格模式下，会有如下一些限制：</div><div class="line">未声明的变量赋值直接报错，而不是变成全局变量</div><div class="line">函数默认的 this 将变成 undefined 而不是默认指向 window</div><div class="line">对只读属性进行写操作，删除不可删除属性，对不可拓展的对象添加属性均会抛出异常</div><div class="line">禁止使用 with 语句</div><div class="line">重名的属性会报错，重名的函数参数会报错</div></pre></td></tr></table></figure>
<a id="more"></a>
<h3 id="JSON-支持"><a href="#JSON-支持" class="headerlink" title="JSON 支持"></a>JSON 支持</h3><pre><code>默认支持 JSON.parse 和 JSON.stringify
</code></pre><h3 id="对象和属性"><a href="#对象和属性" class="headerlink" title="对象和属性"></a>对象和属性</h3><pre><code>现在可以对一个对象的属性设置 getter setter:
</code></pre><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"><span class="number">1.</span>每个对象都继承了 <span class="built_in">Object</span>.prototype</div><div class="line"><span class="built_in">Object</span>是一个构造函数</div><div class="line">create是挂在构造函数下面,而不是 <span class="built_in">Object</span>.prototype下,所以实例的对象无法使用create等</div><div class="line"></div><div class="line"><span class="number">2.</span><span class="built_in">Object</span>.create(prototype[,descriptor])</div><div class="line">返回一个原型为prototype且设置了descriptor的对象</div><div class="line"></div><div class="line"><span class="number">3.</span><span class="built_in">Object</span>.defineProperty</div><div class="line"><span class="keyword">var</span> obj = &#123;&#125;;</div><div class="line"><span class="built_in">Object</span>.defineProperty(obj, <span class="string">"name"</span>, &#123;</div><div class="line">  <span class="attr">get</span>: <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</div><div class="line">    <span class="keyword">return</span> name.toUpperCase();</div><div class="line">    &#125;,</div><div class="line">  <span class="attr">set</span>: <span class="function"><span class="keyword">function</span>(<span class="params">n</span>) </span>&#123;</div><div class="line">    name=n;</div><div class="line">    &#125;</div><div class="line">&#125;)</div><div class="line">可以定义一个对象的属性是否可以修改、是否可以删除、是否可以添加:</div><div class="line"><span class="built_in">Object</span>.defineProperty( obj, <span class="string">"value"</span>, &#123;</div><div class="line">    <span class="attr">value</span>: <span class="literal">true</span>,</div><div class="line">    <span class="attr">writable</span>: <span class="literal">false</span>,</div><div class="line">    <span class="attr">enumerable</span>: <span class="literal">true</span>,</div><div class="line">    <span class="attr">configurable</span>: <span class="literal">true</span></div><div class="line">&#125;);</div><div class="line"></div><div class="line"><span class="number">4.</span><span class="built_in">Object</span>.getOwnPropertyDescriptor(obj,property)</div><div class="line">获取obj下,property属性的特性</div><div class="line"></div><div class="line"><span class="number">5.</span><span class="built_in">Object</span>.getOwnpropertyNames(obj) 获取所以属性名</div><div class="line"></div><div class="line"><span class="number">6.</span><span class="built_in">Object</span>.keys(obj)与getOwnpropertyNames类似,只是获取的是可枚举属性名</div><div class="line"></div><div class="line"><span class="number">7.</span><span class="built_in">Object</span>.assign(a,b,c...)浅拷贝</div><div class="line">将b,c的自身的(原型上的不会拷贝),可枚举的,拷贝给a并返回a</div></pre></td></tr></table></figure>
<p>冻结对象:<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line"><span class="number">1.</span><span class="built_in">Object</span>.seal(obj), 使对象的属性配置配置无法修改，等价于给每一个属性都设置成 configurale=<span class="literal">false</span></div><div class="line"><span class="number">2.</span><span class="built_in">Object</span>.freeze(obj)，除了 seal 之外，它还会是属性值本身无法被修改，相当于对每个属性同时进行了 configurable=<span class="literal">false</span> 和 writable=<span class="literal">false</span></div><div class="line">如果<span class="keyword">const</span>一个引用对象,实际是一个引用地址,指向的对象属性仍然会变化</div><div class="line">冻结对象:<span class="keyword">const</span> foo = <span class="built_in">Object</span>.freeze(&#123;&#125;); ---- 不能添加删除属性,能改变值</div><div class="line">彻底的冻结方法:</div><div class="line"><span class="keyword">var</span> constantize = <span class="function">(<span class="params">obj</span>) =&gt;</span> &#123;</div><div class="line">  <span class="built_in">Object</span>.freeze(obj);</div><div class="line">  <span class="built_in">Object</span>.keys(obj).forEach( <span class="function">(<span class="params">key, value</span>) =&gt;</span> &#123;</div><div class="line">    <span class="keyword">if</span> ( <span class="keyword">typeof</span> obj[key] === <span class="string">'object'</span> ) &#123;</div><div class="line">      constantize( obj[key] );</div><div class="line">    &#125;</div><div class="line">  &#125;);</div><div class="line">&#125;;</div><div class="line">冻结对象,然后再遍历冻结内部属性</div><div class="line"><span class="built_in">Object</span>.getOwnPropertyNames</div><div class="line"><span class="built_in">Object</span>.keys</div></pre></td></tr></table></figure></p>
<h3 id="数组新增方法"><a href="#数组新增方法" class="headerlink" title="数组新增方法"></a>数组新增方法</h3><p>数组新增了如下常用的方法：<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div></pre></td><td class="code"><pre><div class="line"><span class="number">1.</span>map(<span class="function">(<span class="params">item,index,arr</span>) =&gt;</span> &#123;</div><div class="line">    将原数组的值,映射,通过<span class="keyword">return</span>返回映射值,最后获得映射的数组</div><div class="line">    <span class="keyword">return</span> xx</div><div class="line">&#125;)</div><div class="line"></div><div class="line"><span class="number">2.</span>filter过滤 用法类似map,返回值 == <span class="literal">false</span>/<span class="literal">true</span> 则抛弃或者留下</div><div class="line"></div><div class="line"><span class="number">3.</span>forEach(item,index,arr-数组本身)</div><div class="line"></div><div class="line"><span class="number">4.</span>indexOf(searchString,[fromIndex]),从第几个开始搜索searchString ,返回索引值</div><div class="line"></div><div class="line"><span class="number">5.</span>reduce-迭代 (fn(previous,current,index,arr),[initialValue])</div><div class="line">[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>].reduce(<span class="function">(<span class="params">a,b</span>) =&gt;</span>&#123;</div><div class="line">    <span class="keyword">return</span> a+b</div><div class="line">&#125;,<span class="number">4</span>) <span class="comment">//10</span></div><div class="line"></div><div class="line"><span class="number">6.</span>reduceRight - 从末尾开始</div><div class="line"></div><div class="line"><span class="number">7.</span>some(fn) 如果有个返回值为<span class="literal">true</span>,则返回<span class="literal">true</span>且不再执行</div><div class="line"></div><div class="line"><span class="number">8.</span>every 每个<span class="keyword">return</span>为<span class="literal">true</span>时,才返回<span class="literal">true</span></div></pre></td></tr></table></figure></p>
<h2 id="ES6"><a href="#ES6" class="headerlink" title="ES6"></a>ES6</h2><h3 id="let与const"><a href="#let与const" class="headerlink" title="let与const"></a>let与const</h3><p>let</p>
<pre><code>1. 声明变量,与var类似
2. 拥有块级作用域
3. 不存在变量提升
4. 暂时性死区
如:先var a 然后{a=2;let a=3} 会报错.
5. 不能重复声明
可以用来替代立即执行函数...
</code></pre><p>const</p>
<pre><code>1. 声明一个常量(必须立即赋值)
2. 其余和let一样
当const一个对引用类型,实际是地址
块级作用域内不要声明函数,用函数表达式来代替
</code></pre><hr>
<h3 id="变量解构赋值"><a href="#变量解构赋值" class="headerlink" title="变量解构赋值"></a>变量解构赋值</h3><p>按一定规则,对数组,对象,arguments,字符串等赋值<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">let</span> [a = <span class="number">2</span>,[b],c = <span class="number">3</span>] = [<span class="number">1</span>,[<span class="number">2</span>],<span class="literal">null</span>];</div><div class="line">==&gt; a = <span class="number">1</span> ,b = <span class="number">2</span> c = <span class="number">3</span>; </div><div class="line">a,b得到右边值,c为默认值</div><div class="line"></div><div class="line">左右两边自动匹配,可以缺省值,不完全解构</div><div class="line">右边如果是不可遍历结构,则会报错</div></pre></td></tr></table></figure></p>
<h3 id="字符串扩展"><a href="#字符串扩展" class="headerlink" title="字符串扩展"></a>字符串扩展</h3><h3 id="正则的扩展"><a href="#正则的扩展" class="headerlink" title="正则的扩展"></a>正则的扩展</h3><h3 id="数值的扩展"><a href="#数值的扩展" class="headerlink" title="数值的扩展"></a>数值的扩展</h3><h3 id="数组的扩展"><a href="#数组的扩展" class="headerlink" title="数组的扩展"></a>数组的扩展</h3><h3 id="函数的扩展"><a href="#函数的扩展" class="headerlink" title="函数的扩展"></a>函数的扩展</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line"><span class="number">1.</span><span class="function"><span class="keyword">function</span>(<span class="params">x = <span class="number">1</span></span>)</span>&#123; <span class="keyword">var</span> x = <span class="number">2</span> &#125; =&gt; x=<span class="number">2</span> 设置x的默认值</div><div class="line"><span class="number">2.</span>rest --- fn中多余的参数组成的数组</div><div class="line"><span class="number">3.</span>...  ---rest的逆运算  如 fn(...items,a) 即将items中的值,与a一起,当作fn的参数使用</div><div class="line"><span class="number">4.</span>箭头函数</div><div class="line">    x =&gt; x*x</div><div class="line">等价</div><div class="line">    <span class="function"><span class="keyword">function</span>(<span class="params">x</span>)</span>&#123;</div><div class="line">         <span class="keyword">return</span> x*x</div><div class="line">    &#125;;</div><div class="line">    </div><div class="line">    y = <span class="function">(<span class="params">x</span>) =&gt;</span> (&#123;<span class="attr">x</span>:<span class="number">1</span>&#125;) </div><div class="line">等价于</div><div class="line">    <span class="keyword">var</span> y = <span class="function"><span class="keyword">function</span>(<span class="params">x</span>)</span>&#123;</div><div class="line">        <span class="keyword">return</span> &#123;<span class="attr">x</span>:<span class="number">1</span>&#125;;</div><div class="line">    &#125;</div><div class="line">参数为一个可省略() , <span class="keyword">return</span>为单条语句可省略()</div><div class="line">内部<span class="keyword">this</span>为环境上下文--(<span class="function"><span class="keyword">function</span>的上下文不定,可能是全局,也可能在对象内部)</span></div><div class="line">5.在严格模式下, 函数可以开启尾部调用来 避免递归等使栈溢出的现象</div></pre></td></tr></table></figure>
<h3 id="对象的扩展"><a href="#对象的扩展" class="headerlink" title="对象的扩展"></a>对象的扩展</h3><pre><code>新增加的数据类型,表示独一无二的值
</code></pre><h3 id="Proxy和Reflect"><a href="#Proxy和Reflect" class="headerlink" title="Proxy和Reflect"></a>Proxy和Reflect</h3><pre><code>proxy---进行对对象的操作进行代理,修改操作的默认行为
</code></pre><h3 id="Set和Map数据结构"><a href="#Set和Map数据结构" class="headerlink" title="Set和Map数据结构"></a>Set和Map数据结构</h3><h3 id="Promise对象"><a href="#Promise对象" class="headerlink" title="Promise对象"></a>Promise对象</h3><h3 id="Class"><a href="#Class" class="headerlink" title="Class"></a>Class</h3><h3 id="Decorator"><a href="#Decorator" class="headerlink" title="Decorator"></a>Decorator</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">export</span>与<span class="keyword">import</span>都需要位于顶部环境,不能在块级作用域中</div><div class="line"></div><div class="line"><span class="keyword">export</span> <span class="keyword">var</span> a = <span class="string">'a'</span>;</div><div class="line"><span class="keyword">export</span> <span class="keyword">var</span> c = <span class="string">'c'</span>;</div><div class="line"><span class="keyword">var</span> d = <span class="number">1</span> , f = <span class="number">2</span> ;</div><div class="line">exprot &#123;d,f&#125;;</div><div class="line"><span class="keyword">export</span> fn()&#123;...&#125;</div><div class="line">设置别名</div><div class="line"><span class="keyword">export</span> &#123;</div><div class="line">    a <span class="keyword">as</span> a1,</div><div class="line">    b <span class="keyword">as</span> b1</div><div class="line">&#125;</div><div class="line"></div><div class="line">暴露多个接口,就可以引入多个接口</div><div class="line">exprot绑定是动态的,获得的是实时的值</div><div class="line"></div><div class="line"><span class="keyword">import</span></div><div class="line"></div><div class="line"><span class="number">1.</span>提升效果</div><div class="line"><span class="number">2.</span><span class="keyword">import</span> &#123;a,b,c&#125; <span class="keyword">from</span> <span class="string">"./xx"</span></div><div class="line"><span class="number">3.</span><span class="keyword">import</span> * <span class="keyword">as</span> abc <span class="keyword">from</span> <span class="string">"./xx"</span> 将a,b,c 都加载到abc对象上面</div><div class="line"></div><div class="line"><span class="keyword">export</span> <span class="keyword">default</span></div><div class="line"></div><div class="line">设置暴露的默认接口</div><div class="line"></div><div class="line"><span class="keyword">export</span> <span class="keyword">default</span> <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</div><div class="line">    <span class="keyword">return</span> a;</div><div class="line">&#125;</div><div class="line"><span class="keyword">export</span> <span class="keyword">var</span> b = <span class="string">"b"</span>;</div><div class="line"></div><div class="line"><span class="keyword">import</span> c <span class="keyword">from</span> <span class="string">"xx"</span></div><div class="line">直接使用,用的是默认的</div><div class="line">通过c.b来使用其他的接口</div></pre></td></tr></table></figure>
<h3 id="编程风格"><a href="#编程风格" class="headerlink" title="编程风格"></a>编程风格</h3><h3 id="读懂规格"><a href="#读懂规格" class="headerlink" title="读懂规格"></a>读懂规格</h3><h3 id="二进制数组"><a href="#二进制数组" class="headerlink" title="二进制数组"></a>二进制数组</h3><h3 id="SIMD"><a href="#SIMD" class="headerlink" title="SIMD"></a>SIMD</h3>
      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/lh706.github.io/tags/JavaScript/" rel="tag"># JavaScript</a>
          
            <a href="/lh706.github.io/tags/总结/" rel="tag"># 总结</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/lh706.github.io/2017/05/20/锋利的jquery/" rel="next" title="锋利的jquery">
                <i class="fa fa-chevron-left"></i> 锋利的jquery
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/lh706.github.io/2017/05/20/H5API/" rel="prev" title="H5API">
                H5API <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/lh706.github.io/my.jpg"
               alt="Albert" />
          <p class="site-author-name" itemprop="name">Albert</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
           
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/lh706.github.io/archives">
                <span class="site-state-item-count">20</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/lh706.github.io/tags/index.html">
                <span class="site-state-item-count">11</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/lh706" target="_blank" title="GitHub">
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.zhihu.com/people/liang-da-shu-shu" target="_blank" title="知乎">
                  
                  知乎
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#ES5"><span class="nav-number">1.</span> <span class="nav-text">ES5</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#use-strict"><span class="nav-number">1.1.</span> <span class="nav-text">use strict</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#JSON-支持"><span class="nav-number">1.2.</span> <span class="nav-text">JSON 支持</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#对象和属性"><span class="nav-number">1.3.</span> <span class="nav-text">对象和属性</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#数组新增方法"><span class="nav-number">1.4.</span> <span class="nav-text">数组新增方法</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#ES6"><span class="nav-number">2.</span> <span class="nav-text">ES6</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#let与const"><span class="nav-number">2.1.</span> <span class="nav-text">let与const</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#变量解构赋值"><span class="nav-number">2.2.</span> <span class="nav-text">变量解构赋值</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#字符串扩展"><span class="nav-number">2.3.</span> <span class="nav-text">字符串扩展</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#正则的扩展"><span class="nav-number">2.4.</span> <span class="nav-text">正则的扩展</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#数值的扩展"><span class="nav-number">2.5.</span> <span class="nav-text">数值的扩展</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#数组的扩展"><span class="nav-number">2.6.</span> <span class="nav-text">数组的扩展</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#函数的扩展"><span class="nav-number">2.7.</span> <span class="nav-text">函数的扩展</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#对象的扩展"><span class="nav-number">2.8.</span> <span class="nav-text">对象的扩展</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Proxy和Reflect"><span class="nav-number">2.9.</span> <span class="nav-text">Proxy和Reflect</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Set和Map数据结构"><span class="nav-number">2.10.</span> <span class="nav-text">Set和Map数据结构</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Promise对象"><span class="nav-number">2.11.</span> <span class="nav-text">Promise对象</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Class"><span class="nav-number">2.12.</span> <span class="nav-text">Class</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Decorator"><span class="nav-number">2.13.</span> <span class="nav-text">Decorator</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#编程风格"><span class="nav-number">2.14.</span> <span class="nav-text">编程风格</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#读懂规格"><span class="nav-number">2.15.</span> <span class="nav-text">读懂规格</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#二进制数组"><span class="nav-number">2.16.</span> <span class="nav-text">二进制数组</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#SIMD"><span class="nav-number">2.17.</span> <span class="nav-text">SIMD</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Albert</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  <script type="text/javascript" src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/fastclick/1.0.6/fastclick.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazyload/1.9.3/jquery.lazyload.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js"></script>

  
  <script type="text/javascript" src="//cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.pack.js"></script>

  
  <script type="text/javascript" src="/lh706.github.io/lib/canvas-nest/canvas-nest.min.js"></script>


  


  <script type="text/javascript" src="/lh706.github.io/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/lh706.github.io/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/lh706.github.io/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/lh706.github.io/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/lh706.github.io/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

</body>
</html>
